# -.- coding: utf-8 -.-

from django.conf.urls.defaults import *
from django.views.generic import DetailView, ListView, DeleteView, TemplateView, list_detail
from django.views.generic.simple import direct_to_template
from app_planning.views import *

urlpatterns = patterns('app_planning.views',
                        #Index vacío
                        url(r'^$',
                            direct_to_template, 
                            {
                                'template':"app_planning/index.html",
                            },
                            name='planner_index'
                        ),
                        #Pruebas con backbone
                        url(r'^backbone/$',
                            TemplateView.as_view(
                                template_name="app_planning/backbone.html"
                            ),
                            name='planner_backbone'
                        ),
                        url(r'^list/$',
                            ListView.as_view(
                                queryset=Planning.objects.all().order_by('-title'),
                                context_object_name='Plannings',
                                template_name= 'app_planning/list_planning.html'
                            ),
                            name='list_planning'
                        ),
                        #CRUD Plannings
                        url(r'^new_planning/$', new_planning, kwargs={}, name='new_planning'),
                        url(r'^planning/(?P<pk>[^/]+)/$', view_planning, kwargs={}, name='view_planning'),
                        #url(r'^planning/(?P<pk>[^/]+)/$', 
                        #    DetailView.as_view(
                        #        model = Planning,
                        #        template_name = 'app_planning/view_planning.html'
                        #    ),
                        #    kwargs={},
                        #    name='view_planning'
                        #),
                        url(r'^planning/(?P<planning_id>[^/]+)/delete/$', delete_planning, kwargs={}, name='delete_planning'),
                        
                        #Others Planning
                        url(r'^planning/(?P<planning_id>[^/]+)/activate/$', activate, kwargs={}, name='activate_planning'),
                        
                        #CRUD Actions
                        url(r'^planning/(?P<planning_id>[^/]+)/new_action/$', new_action, kwargs={}, name='new_action'),
                        url(r'^action/(?P<pk>[^/]+)/$', 
                            DetailView.as_view(
                                model = Action,
                                template_name = 'app_planning/view_action.html'
                            ),
                            name='view_action'
                        ),
                        url(r'^action/(?P<action_id>[^/]+)/delete/$', delete_action, kwargs={}, name='delete_action'),
                        
                        #CRUD TimeSlots
                        url(r'^action/(?P<action_id>[^/]+)/new_timeslot/$', new_timeslot, kwargs={}, name='new_timeslot'),
                        url(r'^timeslot/(?P<ts_id>[^/]+)/$', 
                            DetailView.as_view(
                                model = TimeSlot,
                                template_name = 'app_planning/view_timeslot.html'
                            ),
                            name='view_timeslot'),
                        url(r'^timeslot/(?P<ts_id>[^/]+)/delete/$', delete_timeslot, kwargs={}, name='delete_timeslot'),
                        
)
